package com.artPreter.service.impl;


import com.artPreter.mapper.EventExhibitionSectionTempMapper;
import com.artPreter.mapper.EventExhibitionTempMapper;
import com.artPreter.pojo.EventExhibition;
import com.artPreter.pojo.EventExhibitionSectionTemp;
import com.artPreter.pojo.EventExhibitionSectionTemp;
import com.artPreter.pojo.EventExhibitionTemp;
import com.artPreter.service.IEventExhibitionSectionTempService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 活动展览栏目表 服务实现类
 * </p>
 *
 * @author jarvis
 * @since 2025-01-07
 */
@Service
public class EventExhibitionSectionTempServiceImpl extends ServiceImpl<EventExhibitionSectionTempMapper, EventExhibitionSectionTemp> implements IEventExhibitionSectionTempService {

    @Autowired
    private EventExhibitionTempMapper eventExhibitionTempMapper;

    @Override
    public EventExhibitionTemp getEventExhibitionTemp(EventExhibitionTemp eventExhibitionTemp) {
        LambdaQueryWrapper<EventExhibitionTemp> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(EventExhibitionTemp::getEventId,eventExhibitionTemp.getEventId());
        List<EventExhibitionTemp> list = eventExhibitionTempMapper.selectList(lambdaQueryWrapper);
        if(list.size()>0){
            return list.get(0);
        }else{
            return null;

        }
    }

    @Override
    public List<EventExhibitionSectionTemp> getList(EventExhibitionSectionTemp eventExhibitionSectionTemp) {
        LambdaQueryWrapper<EventExhibitionSectionTemp> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        System.out.println(eventExhibitionSectionTemp.getEventId());
        if(eventExhibitionSectionTemp.getEventId()!=null){
            lambdaQueryWrapper.eq(EventExhibitionSectionTemp::getEventId, eventExhibitionSectionTemp.getEventId());
        }
        lambdaQueryWrapper.orderByAsc(EventExhibitionSectionTemp::getSort);
        List<EventExhibitionSectionTemp> list = this.baseMapper.selectList(lambdaQueryWrapper);
        return list;
    }
}
